package First;

import java.util.*;


/**
 * Created by msingh on 2014-07-01.
 */
public class Practice {
    //Duplicate in list
    public static List<Integer> create_list() {
        List<Integer> list = new LinkedList<Integer>();
        for(int i=0;i<5;i++){
            list.add(i);
        }
        for(int j=0;j<3;j++){
            list.add(j);
        }
        return list;
    }
    public static Set<Integer> remove_duplicate(List<Integer> list){
        List<Integer> unsorted_list = Practice.create_list();
        Set<Integer> set1 = new HashSet<>();
        Set<Integer> set2 = new HashSet<>();

        for(int yourlist : list){
            if(!set1.add(yourlist)){
                set2.add(yourlist);
            }

        }
        return set2;

    }
    public static void main(String[] args){

        System.out.println("Answer are: " + Practice.create_list());

        System.out.println("Answer are: " + remove_duplicate(Practice.create_list()));
    }
}
